package com.fastand.sample.ui;

import android.os.Bundle;
import android.view.View;

import com.fastand.sample.R;
import com.fastand.sample.base.AppBaseActivity;
import com.yimu.lib.http.net.HttpCallback;
import com.yimu.lib.util.GsonUtil;
import com.yimu.lib.util.MyLogger;
import com.yimu.lib.util.StatusBarCompat;
import com.yimu.lib.ymhttp.Irequest;

import java.util.HashMap;
import java.util.Map;

public class MainActivity extends AppBaseActivity {
    private String url="http://tnq.caigoogoo.com:8881/";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        StatusBarCompat.compat(this,getResources().getColor(com.yimu.lib.R.color.status_bar_color));
        findViewById(R.id.but).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Irequest irequest=new Irequest("A3712C5D2F98263F8C9219E4DA604E2F");
                irequest.httpReques(url, "XX.ChannelTasksHandler.getExtTasks", toDataMap(), new HttpCallback() {
                    @Override
                    public void start() {

                    }

                    @Override
                    public void onSucceed(Object o) {
                        MyLogger.d(String.valueOf(o));

                    }

                    @Override
                    public void onFailed(String errCode) {

                    }
                });
                Irequest irequest2=new Irequest("A3712C5D2F98263F8C9219E4DA604E2F");
                irequest2.httpReques(url, "XX.ConfigHandler.common", toDataMap(), new HttpCallback() {
                    @Override
                    public void start() {

                    }

                    @Override
                    public void onSucceed(Object o) {
                        MyLogger.d(String.valueOf(o));

                    }

                    @Override
                    public void onFailed(String errCode) {

                    }
                });
                Irequest irequest3=new Irequest("A3712C5D2F98263F8C9219E4DA604E2F");
                irequest3.httpReques(url, "XX.MajorHandler.xyx", toDataMap(), new HttpCallback() {
                    @Override
                    public void start() {

                    }

                    @Override
                    public void onSucceed(Object o) {
                        MyLogger.d(String.valueOf(o));

                    }

                    @Override
                    public void onFailed(String errCode) {

                    }
                });
                Irequest irequest4=new Irequest("A3712C5D2F98263F8C9219E4DA604E2F");
                irequest4.httpReques(url, "XX.MajorHandler.withdraw", toDataMap(), new HttpCallback() {
                    @Override
                    public void start() {

                    }

                    @Override
                    public void onSucceed(Object o) {
                        MyLogger.d(String.valueOf(o));

                    }

                    @Override
                    public void onFailed(String errCode) {

                    }
                });
            }
        });


    }
    public String toDataMap(){
        String useid=  "21530597-2832-4eef-9f74-55144a1ed803";
        Map<String, String> hm = new HashMap<>();
        hm.put("userid", useid);
        String data = GsonUtil.getInstance().GsonString(hm);
        return data;
    }
}
